import 'package:flutter/material.dart';
import 'dart:math';
import 'package:sy_flutter_widgets/sy_flutter_widgets.dart';

class SelecterPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return SelecterPageState();
  }
}

class SelecterPageState extends State<SelecterPage> {
  Color _randomColor() {
    var red = Random.secure().nextInt(255);
    var greed = Random.secure().nextInt(255);
    var blue = Random.secure().nextInt(255);
    return Color.fromARGB(255, red, greed, blue);
  }

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Selecter Example"),
      ),
      body: ListView(
        children: <Widget>[
          SyCell(
            icon: Icon(Icons.location_on),
            title: '省市区地址选择器',
            onTap: () async {
              final result = await Navigator.push(
                  context,
                  MaterialPageRoute(
                      builder: (BuildContext context) {
                        return Theme(
                          data: Theme.of(context).copyWith(
                              scaffoldBackgroundColor: Colors.grey[100]),
                          child: SyArea(
                            title: Text('请选择地址'),
                          ),
                        );
                      },
                      fullscreenDialog: true));
              print(result == null ? null : result.toJson());
            },
          ),
        ],
      ),
    );
  }
}
